﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Lead2012.Models;
using Lead2012.Business;

namespace Lead2012.ViewModels
{
    public class LeadImportViewModel : BaseViewModel
    {
        public bool IsError { get; set; }
        public string ErrorMessage { get; set; }
        public String StoreFilePath { get; set; }
        public MappingModel Mapping { get; set; }
        public DataErrorModel DataError { get; set; }
    }

    public class DataErrorModel
    {
        public List<ColumnHeaderModel> ColumnHeaders { get; set; }
        public List<RowModel> ErrorRows { get; set; }
    }

    public class MappingModel
    {
        public int MappingId { get; set; }
        public List<ColumnModel> Columns { get; set; }
        public List<GroupModel> AllFieldGroups { get; set; }
    }

    public class ColumnModel
    {
        public string ColumnName { get; set; }
        public bool IsIgnored { get; set; }
        public FieldModel MappedField { get; set; }
        public List<GroupModel> PossibleGroups { get; set; }
        public List<FieldModel> PossibleFieldsInOrder { get; set; }
    }

    public class GroupModel
    {
        public string Title { get; set; }
        public List<FieldModel> Fields { get; set; }
        public List<SectionModel> Sections { get; set; }
    }

    public class SectionModel
    {
        public string Title { get; set; }
        public List<FieldModel> Fields { get; set; }
    }

    public class FieldModel
    {
        public int TypeId { get; set; }
        public int FieldId { get; set; }
        public string FieldName { get; set; }
        public string Expression { get; set; }
        public string ClientExpression { get; set; }
        public bool IsRequired { get; set; }
        public bool IsUsed { get; set; }
    }

    public class ColumnHeaderModel
    {
        public int FieldId { get; set; }
        public string ColumnName { get; set; }
        public string RegularExpressions { get; set; }
        public bool IsRequired { get; set; }
        public bool IsIgnored { get; set; }
        public int Type { get; set; }
    }

    public class RowModel
    {
        public int RowNumber { get; set; }
        public bool IgnoreWhenImport { get; set; }
        public List<CellModel> Cells { get; set; }
    }

    public class CellModel
    {
        public int CellID { get; set; }
        public string Value { get; set; }
        public bool IsError { get; set; }
        public bool IgnoreValidation { get; set; }
        public bool IsIgnored { get; set; }
        public bool IsDone { get; set; }
        public string ClassName { get; set; }
        public int Type { get; set; }
    }
}
